
#include "STRESS_LED_CONTROL.h"
static int critical_value=0.5;
static int critical_weight=3;
RGB_STATUS rs={LED_OFF,LED_OFF,LED_OFF};
void STRESS_LED_CONCTROL_INIT(){
    RGBLED_INTI();
    CONTROL_RGB(rs);
    stress_sensor_init();
}
void ADD_CRITICAL_VALUE(){
    critical_weight+=1;
    if(critical_weight>5000){
        critical_weight=5000;
    }
}
void SUB_CRITICAL_VALUE(){
    critical_weight-=1;
    if(critical_weight<0){
        critical_weight=0;
    }
}
int GET_CRITICAL_VALUE(){
    return critical_weight;
}
void Control_RGB(float my_weight){
    if (my_weight<=(critical_value+critical_weight)){
        rs.blue=LED_OFF;
        rs.green=LED_OFF;
        rs.red=LED_ON;
        CONTROL_RGB(rs);
    }
    else {
        rs.blue=LED_OFF;
        rs.green=LED_ON;
        rs.red=LED_OFF;
        CONTROL_RGB(rs);
    }
}
//控盘校准
void CORRECT_ZERO(){
    set_maopi();
}
float STRESS_LED_CONTROL(){
    float my_weight=get_weight();
    
    return my_weight;
}